<?php
    if(empty($_GET['orderCount'])){
        $orderCount = 0;
    }
    else{
        $orderCount = $_GET['orderCount'];
    }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
         <link rel="stylesheet" type="text/css" href="css/mcStyle.css"/>
         <script type="text/javascript" src="javascript/ordersJS.js"></script>
        <title>McCanada Restaurants</title>
    </head>
    <body>
        <?php
            include('session.php');
            include('header.php');
            
            echo "<div class='titleBar'>Place An Order</div>";
            echo "<div class='buttonContainer'>";
            $itemsInfo = $database->getItemsInfo();
          
            foreach($itemsInfo as $item){
                echo "<div class='orderButtonDIV'>";
                
                    echo "<form method=\"LINK\" action=\"javascript:addItemToOrder('".$item['name']."', '".$item['itemsID']."', '".$item['foodCodes']."')\">";
                        echo "<input style=\"width:140px;height:35px;font-weight:bold;\" type=\"submit\" value=\"".$item['name']."\" />";
                    echo "</form></div>";
                
            }
            echo "</div>";
            echo "<div class='ordersEntered'>";
                echo "<form method=\"post\" onSubmit=\"return checkOrders()\" action=\"orders.php\">";
                echo "<div id='orderDiv'></div>";
                echo "<div class='orderInfo'>Items Entered: <span id='numItems'>0</span><span id='globItems' style='display:none'>0</span><br />";
                echo "Orders Entered: <span id='numOrders'>".$orderCount."</span>";
                echo "<input type=\"hidden\" name=\"orderCount\" value=\"".$orderCount."\" />";
                echo "<input type=\"submit\" value=\"Submit Order\" />";
                echo "</div></form>";
            echo "</div>";

            include('footer.php');
        ?>
    </body>
</html>
